package de.grosjohann.android.feuerwehr.c2dm;

import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;

public final class C2DM {

  public static final String C2DM_SENDER = "grosjohann@gmail.com";
  public static final String C2DM_PACKAGE = "de.grosjohann.android.feuerwehr";

  public static void register(Context ctx) {
    Intent registrationIntent = new Intent("com.google.android.c2dm.intent.REGISTER");
    registrationIntent.putExtra("app", PendingIntent.getBroadcast(ctx, 0, new Intent(), 0)); // boilerplate
    registrationIntent.putExtra("sender", C2DM_SENDER);

    ctx.startService(registrationIntent);
  }

  public static void unregister(Context ctx) {
    Intent unregIntent = new Intent("com.google.android.c2dm.intent.UNREGISTER");
    unregIntent.putExtra("app", PendingIntent.getBroadcast(ctx, 0, new Intent(), 0));
    ctx.startService(unregIntent);
  }
}
